-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream: fix destroy(err, cb) regression #13156
Conversation
|
||
write.destroy(); | ||
|
||
const expected = new Error('kaboom') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the missing semicolon pass make lint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, I have some leftover files with linting errors under bench, and I didn't spot those :(. Updated
1f399e1
to
502bfaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
conn.on('connect', common.mustCall(function() { | ||
conn.destroy(); | ||
conn.on('error', common.mustCall()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth doing some assertion on the error received here.
502bfaf
to
c294477
Compare
cc @lpinca |
CI (without linting errors): https://ci.nodejs.org/job/node-test-pull-request/8232/ |
|
||
const expected = new Error('kaboom'); | ||
|
||
// the callback will be called asynchronously |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this statement is important you should assert it (set a field on expected
on line 177 and assert it's there in line 175).
c294477
to
f4813b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions.
const assert = require('assert'); | ||
|
||
const server = net.createServer(); | ||
server.listen(0, common.mustCall(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I like it that if a function
is used it's a strong indicator that you need this
bound.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a plain old ES5 function. I tend to say the contrary: I use () => {}
as a strong indicator that I need this
to stay the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool.
|
||
const expected = new Error('kaboom'); | ||
|
||
// the callback will be called asynchronously |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"
@@ -8,7 +8,10 @@ function destroy(err, cb) { | |||
this._writableState.destroyed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO If the cb
should stay undocumented don't put it in the signature, extract it from arguments
.
My IDE (WebStorm) will intellisense it's presence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO we shouldn't use arguments
ever unless we really need to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was done in the previous PR, I would prefer to discuss that in another issue, if you want to fire a PR (I would like to get this in ASAP, keeping it only on the regression).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not feeling strongly about this... Just FYI.
P.S. take the |
Fixed a regression that caused the callback passed to destroy() to not be called if the stream was already destroyed. This caused a regression on the ws module in CITGM introduced by nodejs#12925. Fixes: websockets/ws#1118
f4813b1
to
17aebdf
Compare
[question] About synchronicity of the call to |
@refack there is not. In fact, the comment was just wrong and taken from the other place I copied those examples from. That callback should be called synchronously. |
@refack can you confirm this fix does not causes any more regressions, but it fixes the one I introduced? |
Waiting to the CITGM to do it's dance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CITGM clean
Landed as ccd3ead |
Fixed a regression that caused the callback passed to destroy() to not be called if the stream was already destroyed. This caused a regression on the ws module in CITGM introduced by #12925. PR-URL: #13156 Fixes: websockets/ws#1118 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Fixed a regression that caused the callback passed to destroy() to not be called if the stream was already destroyed. This caused a regression on the ws module in CITGM introduced by #12925. PR-URL: #13156 Fixes: websockets/ws#1118 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Fixed a regression that caused the callback passed to destroy() to not be called if the stream was already destroyed. This caused a regression on the ws module in CITGM introduced by #12925. PR-URL: #13156 Fixes: websockets/ws#1118 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Fixed a regression that caused the callback passed to destroy()
to not be called if the stream was already destroyed.
This caused a regression on the ws module in CITGM, as discovered
by @refack.
Fixes: websockets/ws#1118
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
stream, net